package com.caochenlei.recursion;

public class Factorial {
    public static void main(String[] args) {
        System.out.println("5的阶乘：" + fact(5));
    }

    //求阶乘
    public static int fact(int n) {
        if (n == 0) {
            return 1;
        }
        return n * fact(n - 1);
    }
}
